package JAVA300.第十章IO;

import java.io.*;

/**
 * 字节输出流
 */

public class IO_Study04 {
    public static void main(String[] args) {

        File file = new File("outFile.txt");
        OutputStream outputStream = null;

        try {
           outputStream  = new FileOutputStream(file,true);

            String msg = "hqq is so cute\r\n";
            byte[] datas = msg.getBytes();//编码

            outputStream.write(datas);
            outputStream.flush();//缓存清楚
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (null != outputStream){
                try {
                    outputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
